#include<iostream>
#include<queue>
#include<vector>
#include<algorithm>
#define int long long
#define pb push_back
using namespace std;
const int INF=1e18,N=3e5+5,NN=2e6+5,M=3e7+5;
bool Med;
int n,m,A,B,tot;
namespace SSP{
	int to[M],w[M],nxt[M],h[NN],d[NN],idx,vis[NN];
	inline void add(int u,int v,int e){to[++idx]=v,nxt[idx]=h[u],h[u]=idx,w[idx]=e;}
	priority_queue<pair<int,int>>Q;
	inline void solve(int s=1){
		for(int i=1;i<=tot;++i) d[i]=INF,vis[i]=0;
		Q.push({d[s]=0,s});
		while(!Q.empty()){
			int x=Q.top().second;Q.pop();
			if(vis[x]++) continue;
			for(int i=h[x];i;i=nxt[i])
				if(d[to[i]]>d[x]+w[i]) Q.push({-(d[to[i]]=d[x]+w[i]),to[i]});
		}
		for(int i=2;i<=n;++i) cout<<d[i]<<"\n";
	}
	#define add SSP::add
}
bool Mst;
int U[N],V[N],deg[N],tag[N],id[N],a[N],Now;
int lc[NN],rc[NN];
vector<int>G[N];
vector<pair<int,int>>del[N];
#define fi first
#define se second
#define mid ((l+r)>>1)
inline int build(int l,int r){
	if(l==r) return G[Now][l-1];
	int now=++tot;
	add(now,lc[now]=build(l,mid),0),add(now,rc[now]=build(mid+1,r),0);
	return now;
}
inline void link(int k,int l,int r,int L,int R,int id,int w){
	if(L<=l&&R>=r) return add(id,k,w),void();
	if(L<=mid) link(lc[k],l,mid,L,R,id,w);
	if(R>mid) link(rc[k],mid+1,r,L,R,id,w);
}
signed main(){
	freopen("edge.in","r",stdin);
	freopen("edge.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cerr<<(&Med-&Mst)/1024.0/1024.0<<"\n";
	cin>>n>>m>>A>>B,tot=n;
	for(int i=1;i<=m;++i)
		cin>>U[i]>>V[i],++deg[U[i]],++deg[V[i]],add(U[i],V[i],A),add(V[i],U[i],A);
	for(int i=1;i<=m;++i){
		if(deg[U[i]]>deg[V[i]]||(deg[U[i]]==deg[V[i]]&&U[i]>V[i])) swap(U[i],V[i]);
		G[U[i]].pb(V[i]);
	}
	for(int u=1;u<=n;++u){
		for(auto v:G[u]) tag[v]=u;
		for(auto v:G[u])
			for(auto w:G[v])
				if(tag[w]==u)
					del[u].pb({v,w}),del[u].pb({w,v}),
					del[v].pb({u,w}),del[v].pb({w,u}),
					del[w].pb({v,u}),del[w].pb({u,v});
	}
	for(int i=1;i<=n;++i) G[i].clear();
	for(int i=1;i<=m;++i) G[U[i]].pb(V[i]),G[V[i]].pb(U[i]);
	for(int u=1;u<=n;++u){
		int cnt,Cnt=0,sz=del[u].size();
		sort(del[Now=u].begin(),del[u].end());
		sort(G[u].begin(),G[u].end());
		for(auto v:G[u]) id[v]=++Cnt;
		int rt=build(1,Cnt),l=0,r=0;
		for(auto v:G[u]){
			if((l==sz)||del[u][l].fi!=v){
				link(rt,1,Cnt,1,Cnt,v,B);
				continue;
			}
			r=l;
			while(r+1<sz&&del[u][r+1].fi==del[u][l].fi) ++r;
			cnt=0;
			for(int i=l;i<=r;++i) a[++cnt]=id[del[u][i].se];
			sort(a+1,a+cnt+1);
			for(int i=1;i<=cnt;++i)
				if(a[i-1]+1!=a[i]) link(rt,1,Cnt,a[i-1]+1,a[i]-1,del[u][l].fi,B);
			if(a[cnt]!=Cnt) link(rt,1,Cnt,a[cnt]+1,Cnt,del[u][l].fi,B);
			l=r+1;
		}
	}
	SSP::solve();
} 